-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add range match policy type for enrich #65781
Conversation
Pinging @elastic/es-core-features (Team:Core/Features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this looks good and the change is smaller than I thought it would be.
Can you also add docs for this new enrich policy type?
Maybe also add a rest test to CommonEnrichRestTestCase
?
@@ -67,6 +67,11 @@ public Processor create(Map<String, Processor.Factory> processorFactories, Strin | |||
throw ConfigurationUtils.newConfigurationException(TYPE, tag, "max_matches", "should be between 1 and 128"); | |||
} | |||
|
|||
if (EnrichPolicy.RANGE_MATCH_TYPES.contains(policyType)) { | |||
// range match uses the same processor as simple match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extend the comment here by including that a term query on a range field is translated into a range query with the values as lower and upper value. If multiple values are provided then each value is translates into a range query and that is then combined into a boolean query with should clauses, which means that on of the provided values need to fall into the range of the range field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had just a few comments. +1 on adding some docs, but otherwise looks pretty good.
|
||
private static final ParseField QUERY = new ParseField("query"); | ||
private static final ParseField INDICES = new ParseField("indices"); | ||
private static final ParseField MATCH_FIELD = new ParseField("match_field"); | ||
private static final ParseField ENRICH_FIELDS = new ParseField("enrich_fields"); | ||
private static final ParseField FORMAT = new ParseField("elasticsearch_version"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should use a different field name in the constructor
@@ -245,13 +245,21 @@ private static void validateField(Map<?, ?> properties, String fieldName, boolea | |||
} | |||
} | |||
|
|||
private XContentBuilder resolveEnrichMapping(final EnrichPolicy policy) { | |||
@SuppressWarnings("unchecked") | |||
private XContentBuilder resolveEnrichMapping(final EnrichPolicy policy, GetIndexResponse getIndexResponse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is getIndexResponse
used in this method?
@probakowski - can this be closed in favor of #76110 ? |
The tests got reused, and I think all functionality is covered, please reopen if these assumptions are false |
This change adds new policy types to support all range types as enrich fields. It also adds new
format
field in enrich policy definition that lets you specify date format that will be used during creation of enrich indexCloses #59037